
import re

def remove_citations(text):
    # 使用正则表达式匹配并删除 [[数字]](网址) 格式的引用
    pattern = r'\[\[\d+\]\]\(https?://[^\s\)]+\)'
    cleaned_text = re.sub(pattern, '', text)
    return cleaned_text

# 读取输入文件
input_file = '填充.md'  # 替换为您的输入文件名
with open(input_file, 'r', encoding='utf-8') as file:
    content = file.read()

# 删除引用
cleaned_content = remove_citations(content)

# 将清理后的内容写入新文件
output_file = '填充-nolink.md'  # 替换为您想要的输出文件名
with open(output_file, 'w', encoding='utf-8') as file:
    file.write(cleaned_content)

print(f"引用已被删除。清理后的内容已保存到 {output_file}")


#
